home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / IBM VisualAge for Java Enterprise v4.0 Retail / ivj40 / setup / IDE.Cab / F83918_TreeFactoryTreeElement.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-07-14  |  2.1 KB  |  57 lines

  1. package com.ibm.xml.parser.util;
  2.  
  3. import com.ibm.xml.parser.Child;
  4. import com.ibm.xml.parser.Parent;
  5. import com.ibm.xml.parser.TXElement;
  6. import java.util.Enumeration;
  7. import javax.swing.tree.TreeNode;
  8. import org.w3c.dom.Node;
  9.  
  10. public class TreeFactory$TreeElement extends TXElement implements TreeNode {
  11.    public TreeFactory$TreeElement(String var1) {
  12.       super(var1);
  13.    }
  14.  
  15.    public Enumeration children() {
  16.       return ((Parent)this).elements();
  17.    }
  18.  
  19.    public boolean getAllowsChildren() {
  20.       return true;
  21.    }
  22.  
  23.    public TreeNode getChildAt(int var1) {
  24.       return (TreeNode)((Parent)this).getChildNodes().item(var1);
  25.    }
  26.  
  27.    public int getChildCount() {
  28.       return ((Parent)this).getChildNodes().getLength();
  29.    }
  30.  
  31.    public int getIndex(TreeNode var1) {
  32.       int var2 = 0;
  33.  
  34.       for(Node var3 = ((Parent)this).getFirstChild(); var3 != null; var3 = var3.getNextSibling()) {
  35.          if (var3 == var1) {
  36.             return var2;
  37.          }
  38.  
  39.          ++var2;
  40.       }
  41.  
  42.       return -1;
  43.    }
  44.  
  45.    public TreeNode getParent() {
  46.       return (TreeNode)((Child)this).getParentNode();
  47.    }
  48.  
  49.    public boolean isLeaf() {
  50.       return !((Parent)this).hasChildNodes();
  51.    }
  52.  
  53.    public String toString() {
  54.       return ((TreeFactory)((Child)this).getFactory()).convertValueToText(this);
  55.    }
  56. }
  57.